﻿using System;
using System.ComponentModel.Design;

namespace ServiceProviderPractice
{
    class ServiceProvider : ServiceContainer
    {
        public static ServiceProvider Instance
        {
            get
            {
                return new ServiceProvider();
            }
        }

        private ServiceProvider()
        {
            BuildService();
        }

        private void BuildService()
        {
            AddService(typeof(IProductServcie),ServiceCreator);
        }

        private object ServiceCreator(IServiceContainer container, Type serviceType)
        {
            return new ProductService();
        }
    }


}
